package com.nbjtjc.safe.mapper.sys;

import com.nbjtjc.safe.model.sys.SysUserPost;
import com.nbjtjc.util.MyMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SysUserPostMapper extends MyMapper<SysUserPost> {

    @ResultMap("BaseResultMap")
    @Select("select sys_user_post.* ,sys_post.post_name as postName from" +
            " sys_user_post " +
            " left join sys_post on sys_user_post.post_id=sys_post.id "+
            " where sys_user_post.user_id=#{userId}")
    List<SysUserPost> findByUserId(@Param("userId") int userId);

    @Delete("delete from sys_user_post where user_id=#{userId} ")
    int deleteByUserId(@Param("userId") int userId);
}